@use 'themes' as *;
@use 'global' as *;

.blog-bg {
  @include themed() {
    background-color: themed('bg');
  }
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
  }

  h1 {
    z-index: 2;
    @include themed() {
      color: themed('nav-text');
    }
  }
  p {
    z-index: 2;
    @include themed() {
      font-weight: 100;
      color: rgba(themed('nav-text'), 0.7);
    }
  }
}
// Blog post styles
.blog-post {
  padding: 1.5rem;
  border-radius: 0.5rem;
  @include themed() {
    border-bottom: 1px solid themed('border');
    background-color: themed('bg');
  }

  .blog-info {
    @include hover-effect {
      @include themed() {
        background-color: rgba(themed('primary'), 0.01);

        .post-title {
          color: themed('primary');
        }

        .post-meta {
          color: themed('primary');
        }

        .post-excerpt {
          color: themed('primary');
        }

        .read-more {
          color: themed('primary');
        }
      }
    }
  }

  .post-title {
    transition: all 0.3s ease;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    @include themed() {
      color: themed('text');
    }
    @include responsive(md) {
      font-size: 1.75rem;
    }
  }

  .post-meta {
    transition: all 0.3s ease;
    @include themed() {
      color: themed('text-light');
    }
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
  }

  .post-excerpt {
    transition: all 0.3s ease;
    @include themed() {
      color: themed('text-light');
    }
    margin-bottom: 1rem;
    overflow-wrap: break-word;
  }

  .read-more {
    transition: all 0.3s ease;
    @include themed() {
      color: themed('text-light');
    }
  }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;

  .tag {
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    @include themed() {
      background-color: themed('border');
      color: themed('text');
    }
    border-radius: 9999px;
    font-size: 0.875rem;

    @include hover-effect {
      background-color: themed('primary');
      color: white;
    }
  }
}

// Sidebar styles
.sidebar {
  .blog-card {
    padding: 1.5rem;
    @include themed() {
      border-bottom: 1px solid themed('border');
      background-color: themed('bg');
    }
    margin-bottom: 1.5rem;

    &:last-child {
      margin-bottom: 0;
    }

    h3 {
      font-size: 1.25rem;
      margin-bottom: 1rem;
    }
  }

  .profile {
    text-align: left;

    .avatar {
      width: 6rem;
      height: 6rem;
      border-radius: 9999px;
      overflow: hidden;
      @include themed() {
        background-color: themed('border');
      }

      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }

    .social-links {
      display: flex;
      gap: 1rem;
      margin-top: 1rem;

      a {
        @include themed() {
          color: themed('text-light');
          @include hover-effect {
            color: themed('primary');
          }
        }
      }
    }
  }

  .tags-cloud {
    .tag {
      display: inline-block;
      padding: 0.25rem 0.75rem;
      @include themed() {
        background-color: themed('border');
        color: themed('text');
        @include hover-effect {
          background-color: themed('primary');
          color: white;
        }
      }
      border-radius: 9999px;
      font-size: 0.875rem;
      margin: 0.25rem;
    }
  }

  .recent-posts {
    ul {
      list-style: none;
      padding: 0;
      margin: 0;

      li {
        margin-bottom: 0.75rem;

        &:last-child {
          margin-bottom: 0;
        }

        a {
          @include themed() {
            color: themed('text-light');
            @include hover-effect {
              color: themed('primary');
            }
          }
        }
      }
    }
  }
}

@media (max-width: 768px) {
  .blog-post {
    padding: 1rem !important;
  }
}
